package com.googlecode.lookie.platform.state;

import java.io.File;

import org.springframework.beans.factory.InitializingBean;

public class SystemPropertyStateLocation
    extends DefaultStateLocation
    implements InitializingBean
{

    private String propertyName;

    public SystemPropertyStateLocation()
    {
        super();
    }

    public String getPropertyName()
    {
        return propertyName;
    }

    public void setPropertyName( String propertyName )
    {
        this.propertyName = propertyName;
    }

    public void afterPropertiesSet()
    {
        String path = System.getProperty( propertyName );
        if ( path != null && path.trim().length() > 0 )
        {
            setRoot( new File( path ) );
        }
    }

}
